package com.white.hot.utils;

import java.util.Iterator;


public class TextUtils
{
	public static boolean isEmpty(CharSequence str)
	{
		if(str == null)
		{
			return true;
		}else
		{
			return str.length() == 0;			
		}
	}
	
	public static String join(CharSequence delimiter, Iterable tokens) {
        StringBuilder sb = new StringBuilder();
        Iterator<?> it = tokens.iterator();
        if (it.hasNext()) {
            sb.append(it.next());
            while (it.hasNext()) {
                sb.append(delimiter);
                sb.append(it.next());
            }
        }
        return sb.toString();
    }
	
	public static String join(CharSequence delimiter, Object[] objs)
	{
		StringBuffer sb = new StringBuffer();
		if(objs != null && objs.length > 0)
		{
			int len = objs.length;
			for(int i=0;i<len;i++)
			{
				sb.append(objs[i].toString());
				if(i + 1 != len)
					sb.append(delimiter);
			}
		}
		return sb.toString();
	}
}
